package com.wenwan.manage.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.wenwan.manage.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/test")
@Controller
public class TestController {

	 @Autowired
	 private TestService testService;

	@Autowired
	private HttpServletRequest request;

	@RequestMapping("/data")
	@ResponseBody
	public Map<String, Object> queryCurrentDate(@RequestParam(required = true) String name) {
		Map<String, Object> map = new HashMap<String, Object>();

		request.getSession().setAttribute("sessionKey", name);
		System.out.println(request.getRequestedSessionId());
		System.out.println(request.getSession().getId());

		return map;
	}

	@RequestMapping("/get")
	@ResponseBody
	public Map<String, Object> other() {
		Map<String, Object> map = new HashMap<String, Object>();

		System.out.println(request.getSession().getAttribute("sessionKey"));
		System.out.println(request.getRequestedSessionId());
		System.out.println(request.getSession().getId());

		return map;
	}

}
